package com.markedquilt.interedu.service.Impl;

import com.markedquilt.interedu.enums.ErrorEnum;
import com.markedquilt.interedu.exception.BusinessException;
import com.markedquilt.interedu.repository.dao.UserDao;
import com.markedquilt.interedu.repository.domain.User;
import com.markedquilt.interedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author ZhangKe
 * @Description
 * @date 2020/3/29 23:33.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User getById(Integer id) throws Exception {
        if (id==null || id==0){
            throw new BusinessException(ErrorEnum.NO_USER);
        }
        return userDao.getById(id);
    }
}
